import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export const constantRoutes = [
  {
    path: '/',
    redirect: '/map',
  },
  // {
  //   path: '/login',
  //   component: () => import('@/views/login/index'),
  //   hidden: true
  // },
  {
    path: '/map',
    component: () => import('@/views/map/index'),
    hidden: true
  },
    {
    path: '/shopMap',
    component: () => import('@/views/map/map'),
    hidden: true
  },
  {
    path: '/communityMap',
    component: () => import('@/views/map/communityMap'),
    hidden: true
  },
    {
    path: '/storeMap',
    component: () => import('@/views/map/storeMap'),
    hidden: true
  },
  {
    path: '/heatMap',
    component: () => import('@/views/map/heatMap'),
    hidden: true
  }
]


const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
